package array.ref;

public class ArrayRefMain {
	
	public static void main(String[] args) {
		int[] aref = new int[]{0,1,2,3};
		int[] bref = aref;
		int[] cref = bref;
		
		// 참조값 출력
		System.out.println("aref: " + aref);
		System.out.println("bref: " + bref);
		System.out.println("cref: " + cref);
		
		aref[0] = 10;
		
		for (int i = 0; i < aref.length; i++) {
			System.out.print("aref[" + i + "]: " +
					aref[i] + "\t");
			System.out.print("bref[" + i + "]: " +
					bref[i] + "\t");
			System.out.println("cref[" + i + "]: " +
					cref[i]);
		}
		
		System.out.println();
		
		bref[1] = 11;
		
		for (int i = 0; i < aref.length; i++) {
			System.out.print("aref[" + i + "]: " +
					aref[i] + "\t");
			System.out.print("bref[" + i + "]: " +
					bref[i] + "\t");
			System.out.println("cref[" + i + "]: " +
					cref[i]);
		}
		
		System.out.println();
		
		cref[2] = 12;
		
		for (int i = 0; i < aref.length; i++) {
			System.out.print("aref[" + i + "]: " +
					aref[i] + "\t");
			System.out.print("bref[" + i + "]: " +
					bref[i] + "\t");
			System.out.println("cref[" + i + "]: " +
					cref[i]);
		}
		
	}
	
}
